package com.team10.hotel.controller;

import com.team10.hotel.domain.Province;
import com.team10.hotel.service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/province")
public class ProvinceController {

    @Autowired
    private ProvinceService provinceService;

    @RequestMapping("/getSome")
    @ResponseBody
    public List<Province> getSomeByProvinceId(String countryId) {
        List<Province> provinces=provinceService.findAllByCountryId(Integer.parseInt(countryId));
        return provinces;
    }
}
